<template>
  <m-modal v-model="visible" title="属性" @ok="handleOk" @cancel="handleCancel">
    <div class="g-pd-20">

      <a-select v-model="curCodeType" style="width:100%;margin-bottom:20px" >
        <a-select-option
          v-for=" (item,index) in codeLanguages"
          :key="index"
          :value="item.value"
          :title="item.label"
          
        >
          {{item.label}}
        </a-select-option>
      </a-select>

      <a-input v-model="curValue" type="textarea" :autoSize="{ minRows: 6, maxRows: 6 }"/>
    </div>
  </m-modal>
</template>
<script>
import { Portal } from 'src/components/common/Portal.vue';
import { codeLanguages } from '../config/index';
import Modal from 'src/components/common/CustomModal';

const comp  = {
  name: 'comp-edit-code',
  components: {
    'm-modal': Modal,

  },
  props: {
    codeType: String,
    value: String
  },
  data() {
    return {
      visible: false,
      curCodeType: this.codeType,
      curValue: this.value || '',
      codeLanguages
    };
  },
  mounted(){
    this.visible = true;

  },
  methods: {
    handleOk(){
      this.visible = false;
			
      this.$emit('sure', { codeType: this.curCodeType, value: this.curValue });
    },
    handleCancel(){
      this.visible = false;
      this.$emit('close');
    },
  }
};
export default comp;
export const editCode = new Portal(comp);
</script>
<style lang="scss">
</style>